<?php

/**
 * Profil form.
 *
 * @package    dnevnik
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
 */
class ProfilForm extends BaseProfilForm
{

  /**
  * @desc  Ako je username postavljen, pokusace da dodeli ako nije zauzet
  *        Ako je username prazan postavice default u profil->save()
  */

  public function configure()
  {
    $this->setWidget('tip', new sfWidgetFormInputHidden());
    $this->setWidget('pol', new sfWidgetFormChoice(array('choices' => ProfilPeer::getPols())));
    $this->offsetUnset('password');
    $this->validatorSchema['plain_password'] = new sfValidatorPass();
    $this->offsetUnset('last_activ');
    $this->offsetUnset('poruka_profil_list');

    $this->setValidator('e_mail', new sfValidatorString(array('max_length' => 45, 'required' => false)));
    if(!$this->getObject()->getId())
      $this->offsetUnset('username');
  }
}